<template>
	<view class="content">
		<view class="header-title" @click="goback">
			<image :src="proxy.serverimageUrl + 'back-black.png'" mode=""></image>
			<view class="text">
				新闻政策
			</view>
		</view>
		<z-paging :paging-style="{height: '73.5vh'}" default-page-no="1" default-page-size="10" :fixed="false"
			ref="paging" v-model="dataList" @query="queryList">
			<view class="list-item" @click="godetail(item)" v-for="(item,index) in dataList" :key="index">
				<view class="item-leftimage">
					<image :src="item.url" mode=""></image>
				</view>
				<view class="item-rightbox">
					<p class="p1">{{item.title}}</p>
					<view class="tabs-label">
						<view class="labelitem" v-for="(t,i) in item.keywordList" :key="i">
							{{t}}
						</view>
					</view>
					<view class="num-datetime">
						<view class="num-datetime-text">
							阅读{{item.readingFrequency}}
						</view>
						<view class="num-datetime-text">
							{{item.releaseTime}}
						</view>
					</view>
				</view>
			</view>
		</z-paging>

	</view>
</template>

<script setup>
	import {
		defineProps,
		getCurrentInstance,
		ref
	} from 'vue'
	import {
		articlelist
	} from '../../utils/api.js'
	import {
		onLoad,
		onReady,
		onShow
	} from '@dcloudio/uni-app';
	import useZPaging from "@/uni_modules/z-paging/components/z-paging/js/hooks/useZPaging.js";
	onLoad(() => {})
	const {
		proxy,
		ctx
	} = getCurrentInstance()
	const paging = ref(null)
	const dataList = ref([])
	const queryList = (pageNo, pageSize) => {
		let params = {
			pageNum: pageNo,
			pageSize: pageSize
		}
		articlelist(params).then(res => {
			if (res.code == 200) {
				const list = res.rows
				paging.value.complete(list)
			}
		}).catch(res => {
			paging.value.complete(false)
		})
	}
	const goback = () =>{
		uni.switchTab({
			url:'/pages/Home/index'
		})
	}
	const godetail = (item) =>{
		uni.navigateTo({
			url:'/subpages/article/detail?aid=' + item.aid
		})
	}
</script>

<style scoped lang="scss">
	.content {
		height: 100vh;
		width: 100vw;
		padding: 114rpx 40rpx 0;
		background: #FFFFFF;

		.header-title {
			display: flex;
			align-items: center;

			image {
				width: 18rpx;
				height: 34rpx;
			}

			.text {
				margin-left: 20rpx;
				font-family: Alibaba PuHuiTi;
				font-weight: 500;
				font-size: 36rpx;
				color: #202020;
			}
		}

		::v-deep .zp-paging-container-content {
			padding: 20rpx;
		}

		.list-item {
			margin-top: 30rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.item-leftimage {
				width: 300rpx;
				height: 200rpx;
				border-radius: 20rpx;

				image {
					width: 100%;
					height: 100%;
					border-radius: 20rpx;
				}
			}

			.item-rightbox {
				width: 324rpx;
				margin-left: 22rpx;
				.p1 {
					font-family: Alibaba PuHuiTi;
					font-weight: 400;
					font-size: 30rpx;
					color: #262626;
				}

				.tabs-label {
					margin-top: 20rpx;
					display: flex;

					.labelitem {
						padding: 4rpx 12rpx;
						background: #EAF0FC;
						font-family: Alibaba PuHuiTi;
						font-weight: 400;
						font-size: 22rpx;
						color: #2854B7;
						margin-right: 10rpx;
					}
				}

				.num-datetime {
					margin-top: 40rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;

					.num-datetime-text {
						font-family: Alibaba PuHuiTi;
						font-weight: 400;
						font-size: 24rpx;
						color: #BBC0CA;
					}
				}
			}
		}

	}
</style>